package com.example.registry.service;

public class RegistryFactory {


    public static RegistryService createRegistryService(String address, RegistryType registryType){
        RegistryService registryService=null;
        try {
            switch (registryType) {
                case ZOOKEEPER:
                    registryService = new ZookeeperRegistryService(address);
                    break;
                case EUREKA:
                    registryService = new EurekaRegistryService(address);
                    break;
                default:
                    registryService = new ZookeeperRegistryService(address);
                    break;
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return registryService;
    }
}
